﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GtsServer.DAL;
using GtsServer.Common;

namespace GtsServer.Report
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            DayReportDAL dal = new DayReportDAL();
            int day = Convert.ToInt32(textBox1.Text);
            if (day > 0)
            {
                DataSet ds = dal.SelectReport(day);
                if (ds != null && ds.Tables.Count > 0)
                {
                    ExportExcel.DataTableToLocalExcel(ds.Tables[0], "UserInfo_" + DateTime.Now.ToString("yyyy-MM-dd") + ".xls");
                    ExportExcel.DataTableToLocalExcel(ds.Tables[1], "Order_" + DateTime.Now.ToString("yyyy-MM-dd") + ".xls");
                }
                MessageBox.Show("生成成功!");
            }
        }
    }
}
